#include "ui_mainwindow.h"
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "qglobal.h"
#include "config.h"
#include "mainscene.h"
#define TIMEOUT 1*1000

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    //这里是最初始的界面 生草背景图
    this->setMaximumSize(GAME_WIDTH,GAME_HEIGHT);
    this->setMinimumSize(GAME_WIDTH,GAME_HEIGHT);
    picID=3;
    QPixmap pix("D:\\qt\\untitled12\\3.jpg");
    ui->label->setPixmap(pix);
    //播放 啊 海军 的图片

}


MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_endButton_clicked()
{
    //开始定时器，返回定时器编号
    myTimerId=this->startTimer(TIMEOUT);
}

void MainWindow::timerEvent(QTimerEvent *event)
{
    //开始和循环定时器按钮 预计保留
    if(event->timerId()!=myTimerId)
        return;
    QString path ("D:\\qt\\untitled12\\");
    path +=QString::number(picID);
    path+=".jpg";
    QPixmap pix(path);
    ui->label->setPixmap(pix);
    picID++;
    if(picID==5)
        picID=3;
}

void MainWindow::on_startButton_clicked()
{
    //结束定时器按钮 预计删掉
    this->killTimer(myTimerId);
}


